# llibreries necesaries
library(DT)
library(dplyr)
library(plotly)
library(countrycode)
library(ggplot2)
x <- read.csv("data/ESSportal.csv")

Seleció de dades:

 x$religio <- factor(x$rlgdnm, levels = c(1,2,3,4,5,6,7,8,66,77,99), 
                    labels = c("Roman Catholic", "Protestant","Eastern Orthodox",
                               "Other Christian denomination", "Jewish", "Islamic",
                               "Eastern religions","Other non-Christian religions",
                               "Ateu", "No answer", "No answer"))

 Convertir lrscale a factor qualitatiu
x$lrscale <- factor(x$lrscale, 
                             levels = c(0:10, 77, 88, 99),
                             labels = c("Left", 1, 2, 3, 4, 5, 6, 7, 8, 9, "Right", "Refusal", "Don't know", "No answer"))



Pol_Re <- x[, c(
  "cntry", "essround",
  # Religió
  "religio", "rlgdgr", "rlgatnd", "pray",
  # Política
  "lrscale", "polintr", "vote", "ptcpplt",
  "trstprt", "trstprl", "trstplt",
  
  # Economia / benestar
  "stfeco", "gincdif", "freehms", "happy", "hlthhmp",
  # Pes
  "dweight"
)]

write.csv(Pol_Re, file = "Pol_Re_processat.csv", row.names = FALSE)

Taula de variables:

Mapa interactiu ESS: religió o tendència política

Proporció de persones que van votar segons religió (ponderat)

Evolució de la religió i la política al llarg dels anys: